Skip to content

Conversation

@dvzrv
Copy link
Contributor

@dvzrv dvzrv commented Nov 23, 2023

Subject: Do not use query components in URLs for assets in EPUB rendering

Feature or Bugfix

  • Bugfix

Purpose

If the EPUB builder is detected, do not add checksums in a query component to the URL of css and js assets.

Detail

The XHTML in EPUBs does not allow the use of query components in relative URLs.
The checksumming of assets, introduced in
ae20669 unconditionally adds a query component for the checksum, which breaks rendering on many enduser devices (tested on e.g. Kindle Paperwhite 3, Kobo Aura H2O Edition 2).

Relates

Fixes #11598

If the EPUB builder is detected, do not add checksums in a query
component to the URL of css and js assets.

The XHTML in EPUBs does not allow the use of query components in
relative URLs.
The checksumming of assets, introduced in
ae20669 unconditionally adds a query
component for the checksum, which breaks rendering on many enduser
devices (tested on e.g. Kindle Paperwhite 3, Kobo Aura H2O Edition 2).

Fixes sphinx-doc#11598

Signed-off-by: David Runge <[email protected]>
@dvzrv
Copy link
Contributor Author

dvzrv commented Nov 23, 2023

Hmm, I don't think the test failures for py312 and py313 are related to my change, or can they? 🤔

@AA-Turner
Copy link
Member

You could swap the order of the check for a small optimisation, so that the file is not needlessly hashed when using an epub builder.

A

@AA-Turner
Copy link
Member

Please may you also add a test

@AA-Turner AA-Turner merged commit a8f35bb into sphinx-doc:master Jan 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2024
@AA-Turner AA-Turner added this to the 7.3.0 milestone Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EPUB: Relative URL strings must not have a query component

2 participants